  var id = getvl("id");
   var ids = getvl("ids");
  var shopids="";
	if(id!=='' || ids!==''){
		selectshopinfoone();
	}else{
		alert("异常！");
	}
var currentPage=1;
var currentPage2 = 0;
var currentPage3 = 0;
var currentPage4 = 0;
var currentPage5 = 0;


var ss5=0;
function shopinfoAlls5(){
  currentPage = 0;
  currentPage2 = 0;
  currentPage4 = 0;
  currentPage3 = 0;
	 $("#dianpupu").html("");
	  $("#dianpupu2").html("");
	  $("#dianpupu3").html("");
	  $("#dianpupu4").html("");
	  if(currentPage5==0 || currentPage5==1 || currentPage5==2 || ss5!=0){
	  if(id!='' || ids!=''){
		$.ajax({
       url: urlcore + "/api/goods/selectGoodsList?current="+currentPage5+"&shopId="+shopids+"&goodsType=5",
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					ss4=data.data.list.length;
					  $.each(data.data.list,function(y,n){
					  	var dianpupu='<div class="public_goods">'+
				'<a href="7.0.0goods_detail.html?id='+n.id+'">'+
					'<dl>'+
						'<dt>'+
							'<img onerror="errorImg(this)" src="'+n.coverUrl+'"/>'+
						'</dt>'+
						'<dd>'+
							'<h5>'+n.goodsTitle+'</h5>'+
							'<h6>&yen;'+n.packPrice+'</h6>'+/*&yen;'+n.tradePrice+'- */
						'</dd>'+
					'</dl>'
				'</a>';
	          //热卖图标
	          if(n.goodsType==3){
	          	dianpupu+='<div class="dianpu_hot">'+
					   '<img src="images/hot.png" />'+
				     '</div>';
	          }
				    if(n.goodsType==4){
	          dianpupu+'<div class="dianpu_hot">'+
					  '<span>认证专享</span>'+
			  	  '</div>'+
		    	  '</div>';
	          }
			     $("#dianpupu5").append(dianpupu);
					  });
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}

				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
	  }else{
 	  alert("异常。。。。")
 }
	  }
}

var ss4=0;
function shopinfoAlls4(){
  currentPage = 0;
  currentPage2 = 0;
  currentPage3 = 0;
  currentPage5 = 0;
	 $("#dianpupu").html("");
	  $("#dianpupu2").html("");
	   $("#dianpupu3").html("");
	    $("#dianpupu5").html("");
	        if(currentPage4==0 || currentPage4==1 || currentPage4==2 || ss4!=0){
	  if(id!='' || ids!=''){
		$.ajax({
       url: urlcore + "/api/goods/selectGoodsList?current="+currentPage4+"&shopId="+shopids+"&goodsType=1&sort=2",
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					ss4=data.data.list.length;
					  $.each(data.data.list,function(y,n){
					  	var dianpupu=
					  	'<div class="public_goods">'+
				'<a href="7.0.0goods_detail.html?id='+n.id+'">'+
					'<dl>'+
						'<dt>'+
							'<img onerror="errorImg(this)" src="'+n.coverUrl+'"/>'+
						'</dt>'+
						'<dd>'+
							'<h5>'+n.goodsTitle+'</h5>'+
							'<h6> &yen;'+n.packPrice+'</h6>'+/*&yen;'+n.tradePrice+*/
						'</dd>'+
					'</dl>'
				'</a>';
	          //热卖图标
	          if(n.goodsType==3){
	          	dianpupu+='<div class="dianpu_hot">'+
					   '<img src="images/hot.png" />'+
				     '</div>';
	          }
				    if(n.goodsType==4){
	          dianpupu+'<div class="dianpu_hot">'+
					  '<span>认证专享</span>'+
			  	  '</div>'+
		    	  '</div>';
	          }
			     $("#dianpupu4").append(dianpupu);
					  });
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}

				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
	  }else{
 	  alert("异常。。。。")
 }
	  }
}


var ss3=0;
function shopinfoAlls3(){
  currentPage = 0;
  currentPage2 = 0;
  currentPage4 = 0;
  currentPage5 = 0;
	 $("#dianpupu").html("");
	  $("#dianpupu2").html("");
	   $("#dianpupu4").html("");
	    $("#dianpupu5").html("");
	        if(currentPage3==0|| currentPage3==1 || currentPage3==2 || ss3!=0){
	  if(id!='' || ids!=''){
		$.ajax({
       url: urlcore + "/api/goods/selectGoodsList?current="+currentPage3+"&shopId="+shopids+"&goodsType=3&sort=2",
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					ss3=data.data.list.length;
					  $.each(data.data.list,function(y,n){
					  	var dianpupu=
					  	'<div class="public_goods">'+
				'<a href="7.0.0goods_detail.html?id='+n.id+'">'+
					'<dl>'+
						'<dt>'+
							'<img onerror="errorImg(this)" src="'+n.coverUrl+'"/>'+
						'</dt>'+
						'<dd>'+
							'<h5>'+n.goodsTitle+'</h5>'+
							'<h6>&yen;'+n.packPrice+'</h6>'+/*&yen;'+n.tradePrice+'- */
						'</dd>'+
					'</dl>'
				'</a>';
	          //热卖图标
	          if(n.goodsType==3){
	          	dianpupu+='<div class="dianpu_hot">'+
					   '<img src="images/hot.png" />'
				     '</div>';
	          }
				    if(n.goodsType==4){
	          dianpupu+'<div class="dianpu_hot">'+
					  '<span>认证专享</span>'+
			  	  '</div>'+
		    	  '</div>';
	          }
			     $("#dianpupu3").append(dianpupu);
					  });
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}

				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
	  }else{
 	  alert("异常。。。。")
 }
	  }
}
var ss2=0;
function shopinfoAlls2(){
  currentPage = 0;
  currentPage3 = 0;
  currentPage4 = 0;
  currentPage5 = 0;
	 $("#dianpupu").html("");
	  $("#dianpupu3").html("");
	   $("#dianpupu4").html("");
	    $("#dianpupu5").html("");
	        if( currentPage2==0 || currentPage2==1 || currentPage2==2 || ss2!=0){
	  if(id!='' || ids!=''){
		$.ajax({
       url: urlcore + "/api/goods/selectGoodsList?current="+currentPage2+"&shopId="+shopids+"&goodsType=1&sort=2",
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				
				if(data.success == true) {
					ss2=data.data.list.length;
					  $.each(data.data.list,function(y,n){
					  	var dianpupu=
					  	'<div class="public_goods">'+
				'<a href="7.0.0goods_detail.html?id='+n.id+'">'+
					'<dl>'+
						'<dt>'+
							'<img onerror="errorImg(this)" src="'+n.coverUrl+'"/>'+
						'</dt>'+
						'<dd>'+
							'<h5>'+n.goodsTitle+'</h5>'+
							'<h6> &yen;'+n.packPrice+'</h6>'+/*&yen;'+n.tradePrice+'-*/
						'</dd>'+
					'</dl>'
				'</a>';
	          //热卖图标
	          if(n.goodsType==3){
	          	dianpupu+='<div class="dianpu_hot">'+
					   '<img src="images/hot.png" />'+
				     '</div>';
	          }
				    if(n.goodsType==4){
	          dianpupu+'<div class="dianpu_hot">'+
					  '<span>认证专享</span>'+
			  	  '</div>'+
		    	  '</div>';
	          }
			     $("#dianpupu2").append(dianpupu);
					  });
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}

				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
	  }else{
 	  alert("异常。。。。")
 }
	  }
}

var ss=0;
function shopinfoAlls(){
  currentPage2 = 0;
  currentPage3 = 0;
  currentPage4 = 0;
  currentPage5 = 0;
	 $("#dianpupu2").html("");
	 $("#dianpupu3").html("");
	 $("#dianpupu4").html("");
	 $("#dianpupu5").html("");
	 if(currentPage==0 || currentPage==1 || currentPage==2 || ss!=0){
	  if(id!='' || ids!=''){
		$.ajax({
       url: urlcore + "/api/goods/selectGoodsList?current="+currentPage+"&shopId="+shopids+"&goodsType=2&sort=1",
			type: "get",
			dataType: 'json',///goods/selectGoodsList?shopId=' + shopId + "&goodsType=" + goodsType + "&sort=" + sort + "&formatCare=" + formatCare + "&current=" + current
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				console.log(data)
				if(data.success == true) {
					ss=data.data.list.length;
					// var dianpupu="";
					 // dianpupu+='<div style="width:100%;">上市时间：<span>'+data.data.list.uptDatetime+'</span></div>';
					  $.each(data.data.list,function(y,n){
					  	var  dianpupu=
					  	'<div class="public_goods">'+
				'<a href="7.0.0goods_detail.html?id='+n.id+'">'+
					'<dl>'+
						'<dt>'+
							'<img onerror="errorImg(this)" src="'+n.coverUrl+'"/>'+
						'</dt>'+
						'<dd>'+
							'<h5>'+n.goodsTitle+'</h5>'+
							'<h6> &yen;'+n.packPrice+'</h6>'+
						'</dd>'+
					'</dl>'
				'</a>';
	          //热卖图标
	          if(n.goodsType==3){
	          	dianpupu+='<div class="dianpu_hot">'+
					   '<img src="images/hot.png" />'+
				     '</div>';
	          }
				    if(n.goodsType==4){
	          dianpupu+'<div class="dianpu_hot">'+
					  '<span>认证专享</span>'+
			  	  '</div>'+
		    	  '</div>';
	          }
			     $("#dianpupu").append(dianpupu);
					  });
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}

				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
	  }else{
 	  alert("异常。。。。")
 }
	  }
}
	function selectshopinfoone(){
		var ids=sessionStorage.getItem('id');
		if(ids=''){
		  $.ajax({
					url: urlcore + "/api/shopInfo/selectagno1?shopId="+ids,///shopInfo/selectagno1?shopId=' + that.data.shopId,
					type: "get",
					dataType: 'json',
					contentType: "application/json;charset=utf-8",
					success: function(data) {
						if(data.success == true) {
							 $(".jg_dianpuxinxi").css({"background-image":"url("+data.data.storeImg+")"});
							 var newTime1='';
							 newTime1+='<div style="width:60%;height:100%;background:#fff;border-radius:20px;">上市时间：<span>'+data.data.uptDatetime+'</span></div>';
							 $("#newTime").append(newTime1);
							 var creditLevel=data.data.creditLevel;
							 shopids=data.data.id;
							 var dianpuxinxi='<dl class="clearfix">'+
									'<dt>'+
										'<img onerror="errorImg(this)" src="'+data.data.headImg+'" />'+
									'</dt>'+
									'<dd>'+
										'<h5>'+data.data.storeName+'</h5>'+
										'<h6>粉丝数:</h6>'+
										'<div>';
										if(creditLevel<=5){
												for(var i=0;i<creditLevel;i++){
												 dianpuxinxi+='<img src="images/aixin.png"/>';
												}
										}else if(creditLevel<=10){
											var credit=creditLevel-5;
											for(var i=0;i<credit;i++){
												dianpuxinxi+='<img src="images/zhuanshi.png"/>';
											}
										}else if(creditLevel<=15){
											var credit=creditLevel-10;
											for(var i=0;i<credit;i++){
												dianpuxinxi+='<img src="images/guan.png"/>';
											}
										}
										 dianpuxinxi+='</div>'+
									'</dd>'+
								'</dl>'; 
					 $("#dianpuxinxi").append(dianpuxinxi);
					 wxselectfocusshop(shopids);
					 shopinfoAlls(1);
										
						} else if(data.code == 'OVERTIME') {
							var thisUrl = window.location.href;
							alert(thisUrl);
							if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
								top.window.location.href = "1.0.0denglu.html";
							}

						} else {
							if(data.msg != '空数据') {
								alert(data.msg)
							} else {
								$('#thiscount').text(0);
							}
						}

					},
					error: function() {
						alert("error");
					}
		  });
			
		}else if(id!=''){	
		$.ajax({
      url: urlcore + "/api/shopInfo/selectagno1?shopId="+id,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
				 var creditLevel=data.data.creditLevel;
				 shopids=data.data.id;
				 sessionStorage.setItem('phone',data.data.phone);
				 $(".jg_dianpuxinxi").css({"background-image":"url("+data.data.storeImg+")"});
									 $("#dianpudangan").attr("href","6.1.0dianpudangan.html?id="+shopids);
						$("#baobeifenlei").attr("href","6.2.0dianpu_fenlei.html?id="+shopids);
								
									 var dianpuxinxi='<dl class="clearfix">'+
									 '<dt>'+
									 '<img onerror="errorImg(this)"  class="img1" src="'+data.data.headImg+'" />'
									 $("#mdianhua").attr("href",'tel:'+data.data.phone);
							if(creditLevel<=5){
								for(var i=0;i<creditLevel;i++){
									dianpuxinxi+='<img src="images/aixin.png" class="img2"/>';
								}
							}else if(creditLevel<=10){
								var credit=creditLevel-5;
								for(var i=0;i<credit;i++){
										dianpuxinxi+='<img src="images/zuan.png" class="img2"/>';
								}
							}else if(creditLevel<=15){
								var credit=creditLevel-10;
								for(var i=0;i<credit;i++){
										dianpuxinxi+='<img src="images/guan.png" class="img2"/>';
								}
							}
							dianpuxinxi+='</dt>'+
							'<dd>'+
								'<h5>'+data.data.storeName+'</h5>'+
								'<h5>粉丝数：'+data.data.fans+'</h5>'+
								'<div>'+
								'</dd>'+
								'</dl>'; 
								 $("#dianpuxinxi").append(dianpuxinxi);
								  wxselectfocusshop(shopids);
													shopinfoAlls(1);
													
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}

				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
		
			
		}
	
	}


//查询是否关注过该店铺
   function  wxselectfocusshop(shopId){
		 console.log(shopId)
     sessionStorage.setItem('id',shopId)
		var id=sessionStorage.getItem('id')

		   if(id!=""){
		     $.ajax({
					url: urlcore + "/api/shopInfo/isFocusShop?id="+id,
					dataType: 'json',
					contentType: "application/json;charset=utf-8",
					success: function(data) {
				   console.log(data);
				  if(data.success == true) {
						if(data.data==null){	
		          $("#guanzhu").append('<span class="jg_guanzhu" onclick="guanzhu(this)" style="background: rgb(253, 144, 15);">关注</span>');
					   }else{
					   	     
					   	     if(data.data.status==1){
					   	     	
		$("#guanzhu").append('<span class="jg_guanzhu" onclick="guanzhu(this)" style="background: rgb(204, 204, 204);">已关注</span>'); 	
					   	     
					   	     }else if(data.data.status==2){
					   	     	
		$("#guanzhu").append('<span class="jg_guanzhu" onclick="guanzhu(this)" style="background: rgb(204, 204, 204);">已关注</span>'); 	
					   	     
					   	     }
					   	     
					   }
					   $(function() {
					   	//关注
								$('.jg_guanzhu').on('click',function(){		
									if($(this).html() == "关注" ){
										$(this).html("已关注").css("background","#FD900F");
									}else{
										$(this).html("关注").css("background","#FD900F");
									}
									
								});	
					   })
					   
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						//top.window.location.href = "1.0.0denglu.html";
					}
				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
		   
		   }else{
		   	
		   	  $("#guanzhu").append('<span class="jg_guanzhu" onclick="guanzhu(this)" style="background: rgb(253, 144, 15);">关注</span>');
		   
		   }
   }
   

function call(){
	var phone=sessionStorage.getItem('phone')
	window.location.href="tel:"+phone
}
//guanzhu

function guanzhu(te){
	var shopId=sessionStorage.getItem('id');
	// if(uuuuid!=''){
	// if($(te).css("background")=="rgb(204, 204, 204) none repeat scroll 0% 0% / auto padding-box border-box"){
    $.ajax({
		url: urlcore + "/api/focusShop/updateOrAdd?shopId=" +shopId, ///focusShop/updateOrAdd?shopId=' + that.data.shopId,
		type: "get",
		contentType: "application/json;charset=utf-8",
		dataType: "json",
		success: function(data) {
			console.log(data)
			if(data.success == true) {
             shopinfoAlls(1);
			} else if(data.code == 'OVERTIME') {
				var thisUrl = window.location.href;
				if(thisUrl.indexOf('login.html') <= -1) {
				//	top.window.location.href = "login.html";
				}
			} else {
				alert(data.msg);
			}
		},
		error: function() {
			alert("error");
		}
	});
	
   
//    }else{
//    
//    	  $.ajax({
// 		url: urlcore + "/api/focusShop/update33", 
// 		type: "post",
// 		contentType: "application/json;charset=utf-8",
// 		data: JSON.stringify({
// 			userId:uuuuid,
// 			shopId:shopids,
// 		 	status:1
// 		}),
// 		dataType: "json",
// 		success: function(data) {
// 			if(data.success == true) {
// 				shopinfoAlls(1);
// 			} else if(data.code == 'OVERTIME') {
// 				var thisUrl = window.location.href;
// 				if(thisUrl.indexOf('login.html') <= -1) {
// 					top.window.location.href = "login.html";
// 				}
// 			} else {
// 				alert(data.msg);
// 			}
// 		},
// 		error: function() {
// 			alert("error");
// 		}
// 	});
// 	
//    	
//    	
//    }
// 	   }else{
// 	   	alert("未登录");
// 	   }
	
  
	
	
}
